package jpg1.jpg1zad4;

/**
 * Autor: Daniel Michalski
 * Data: 05.07.13
 */

public class Main {
    public static void main(String[] args) {
        try {
            testujWyjatki(5);
        } catch (ExceptionX e) {
            System.out.println("ExceptionX");
        } catch (ExceptionY e) {
            System.out.println("ExceptionY");
        } catch (Exception e) {
            System.out.println("Exception");
        } finally {
            System.out.println("Finally");
        }
    }

    private static void testujWyjatki(int i) throws ExceptionX, ExceptionY, Exception {
        if (i == 1)
            throw new ExceptionX();
        else if (i == 2)
            throw new ExceptionY();
        else
            throw new Exception();
    }
}

class ExceptionX extends Exception { }

class ExceptionY extends Exception { }
